package com.menu.model;

import com.menu.utils.MD5Util;
import com.menu.utils.RandomUtil;
import lombok.Data;

/**
 * author: MaHX
 * date: 2019/8/8/19:25
 * description: 用户表
 **/
@Data
public class User extends BaseModel{
    private String username;
    private String password;
    private String phone;
    private String gender;
    private String avatar;
    private String code;

    public void setUsername(String username) {
        if (username.equals("")){
            RandomUtil randomUtil = new RandomUtil();
            this.username = "user_"+randomUtil.randomBuilder(6);
        }else {
            this.username = username;
        }
    }

    public void setPassword(String password) {
        if (!password.equals("")){
            MD5Util md5Util = new MD5Util();
            this.password = md5Util.encode(password);
        }else {
            this.password = password;
        }
    }


}
